package com.dianrui.operation.adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dianrui.operation.R;
import com.dianrui.operation.bean.Charge;
import com.dianrui.operation.util.StringUtils;

import java.util.List;

    public class ChangeBatteryListAdapter extends BaseQuickAdapter<Charge, BaseViewHolder> {
        private Context mContext;

        public ChangeBatteryListAdapter(int layoutResId, @Nullable List<Charge> data) {
            super(layoutResId, data);
        }


        @Override
        protected void convert(BaseViewHolder helper, Charge charge) {
            helper.setText(R.id.number,charge.number);
            if (StringUtils.isEmpty(charge.city_path)) {
                helper.setText(R.id.city_path,"无");
            }else {
                helper.setText(R.id.city_path,charge.city_path);
            }
            helper.setText(R.id.number,charge.number);
            helper.setText(R.id.battery,charge.battery+""+"%");
            helper.setText(R.id.distance,charge.distance+""+"m");
            helper.addOnClickListener(R.id.startdefense_btn);
            helper.addOnClickListener(R.id.withdrawdevice_btn);
            helper.addOnClickListener(R.id.oppacc_btn);
            helper.addOnClickListener(R.id.play_btn);
            helper.addOnClickListener(R.id.gps_btn);
            helper.addOnClickListener(R.id.check_map);
            helper.addOnClickListener(R.id.finish_btn);
        }
    }
